//
//  MYVisitorController.swift
//  NewMicroblog
//
//  Created by apple on 2016/10/23.
//  Copyright © 2016年 apple. All rights reserved.
//

import UIKit

class MYVisitorController: UIViewController {

    var visitorView :MYVisitorView?
    var login : Bool = MYUserinfoViewModel.sharedModel.islogin
    
    override func loadView() {
        if !login {
            visitorView = MYVisitorView()
            visitorView?.closure = {()->() in
                self.btnClick()
            }
            view = visitorView
            setNav()
        }else{
            view = tableView
        }
    }
    /// 调用此方法跳转控制器
    @objc private func btnClick(){
       let loadVc = MYLoadViewController()
       let nav = MYNavigationController(rootViewController: loadVc)
       present(nav, animated: true, completion: nil)
     }
    
    override func viewDidLoad() {
        super.viewDidLoad()
     }
    
    private func setNav(){
        navigationItem.leftBarButtonItem = UIBarButtonItem(imageName: nil, title: "登录", target: self, action: #selector(btnClick))
         navigationItem.rightBarButtonItem = UIBarButtonItem(imageName: nil, title: "注册", target: self, action: #selector(btnClick))
    }
    
     lazy var tableView = UITableView()

}
